<?php

namespace App\Model;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class Survey extends Model
{
    protected $table = 'survey';
    public $timestamps = false;
    protected $appends = ['cate'];

    /**
     * 创建时间访问器
     * @param $value
     * @return static
     */
    public function getCreateAtAttribute($value){
        return Carbon::createFromTimestamp($value);
    }

    public function getCateAttribute(){
        $cate_id = $this->attributes['cate_id'];
        switch($cate_id){
            case 1:
                return '普通问卷';
            case 2:
                return '员工满意度调查';
        }
    }
}
